package com.ytjj.qmyx.supplychain.service;

import com.ytjj.qmyx.supplychain.mapper.BankerProductSkuKeyMapper;
import com.ytjj.qmyx.supplychain.mapper.entity.YxBankerProductSkuKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class BankerProductSkuKeyService extends AbstractService<BankerProductSkuKeyMapper, YxBankerProductSkuKey> {
    @Resource
    private BankerProductSkuKeyMapper bankerProductSkuKeyMapper;

    public int insertBankerProductSkuKey(YxBankerProductSkuKey bankerProductSkuKey) {
        return bankerProductSkuKeyMapper.insert(bankerProductSkuKey);
    }

    public List<YxBankerProductSkuKey> getBankerProductSkuKeysByPid(Integer pid) {
        Example example = new Example(YxBankerProductSkuKey.class);
        example.createCriteria().andEqualTo("pid", pid).andEqualTo("status", 1);
        List<YxBankerProductSkuKey> list = bankerProductSkuKeyMapper.selectByExample(example);
        return list;
    }
}
